[ Jax FE] Todo Fix memory leak #35643
Open
andersendsa wants to merge 3 commits intoopenvinotoolkit:masterfrom
Open
[ Jax FE] Todo Fix memory leak #35643andersendsa wants to merge 3 commits intoopenvinotoolkit:masterfrom
andersendsa wants to merge 3 commits intoopenvinotoolkit:masterfrom
Conversation
Author
|
Hi @mlukasze could you please tell if this pr needs any changes or if it is good to merge |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses unbounded memory growth in the Python-side JAX frontend decoder traversal by changing the decoder keep-alive container from a strong-reference list to a weak-reference collection.
Changes:
- Replaced
self.m_decoders = []withweakref.WeakSet()inJaxprPythonDecoder. - Updated all
m_decoders.append(...)call sites tom_decoders.add(...).
Comment on lines
+85
to
+86
|
|
||
| self.m_decoders = weakref.WeakSet() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details:
The JAX frontend
JaxprPythonDecoderwas storing all decoders created duringvisit_subgraphin a standard Python list (self.m_decoders). This created strong references, causing memory usage to increase linearly with model size, as noted by an existingTODO.Changes:
Replaced the
self.m_decoders = []list withweakref.WeakSet()to prevent unbound memory growthUpdated all instances of
m_decoders.append()tom_decoders.add().Closes : jax-ml/jax#37352
AI Assistance: